﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Entidades;

namespace CapaPresentacion.Controles
{
    /// <summary>
    /// Lógica de interacción para LabelAndComboWithoutId.xaml
    /// </summary>
    public partial class LabelAndComboWithoutId : UserControl
    {


        public static readonly DependencyProperty FuenteDatosProperty = DependencyProperty.Register("FuenteDatos", typeof(List<ViewEntity>), typeof(LabelAndComboWithoutId));
        public static readonly DependencyProperty ValorSeleccionadoProperty = DependencyProperty.Register("ValorSeleccionado", typeof(string), typeof(LabelAndComboWithoutId));
       



        public LabelAndComboWithoutId()
        {
            InitializeComponent();

            Binding b1 = new Binding();
            b1.Source = this;
            b1.Path = new PropertyPath(LabelAndComboWithoutId.FuenteDatosProperty);
            b1.Mode = BindingMode.TwoWay;
            this.cmb.SetBinding(ComboBox.ItemsSourceProperty, b1);

            Binding b2 = new Binding();
            b2.Source = this;
            b2.Path = new PropertyPath(LabelAndComboWithoutId.ValorSeleccionadoProperty);
            b2.Mode = BindingMode.TwoWay;
            this.cmb.SetBinding(ComboBox.SelectedValueProperty, b2);

            this.cmb.DisplayMemberPath = "Descripcion";
            this.cmb.SelectedValuePath = "Descripcion";

        }

        public string Etiqueta
        {
            get { return lbl.Content.ToString(); }

            set { lbl.Content = value; }
        }

        public string ValorSeleccionado
        {
            get
            {
                return (String)this.GetValue(ValorSeleccionadoProperty);
            }

            set
            {
                this.SetValue(ValorSeleccionadoProperty, value);
            }
        }


        public List<ViewEntity> FuenteDatos
        {
            get
            {
                return (List<ViewEntity>)this.GetValue(FuenteDatosProperty);
            }

            set { SetValue(FuenteDatosProperty, value); }

        }


        public Style Estilo
        {

            set
            {
                cmb.Style = value;
            }
        }




    }
}
